﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Trust.aspx.cs" Inherits="Task.Trust" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>委托设置</title>
    <link href="css/style.css" rel="stylesheet" rev="stylesheet" />
    <link href="css/global.css" rel="stylesheet" rev="stylesheet" />
    <link href="css/UI_Css/jquery-ui-1.8.17.custom.css" rel="stylesheet" rev="stylesheet" />
    <link href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css"
        rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="script/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="script/jquery-ui-1.8.17.custom.min.js"></script>
    <script src="../Scripts/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="../Scripts/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
    <%--<script src="../Scripts/Comm.js" type="text/javascript"></script>--%>
    <script type="text/javascript" src="script/My97DatePicker_4.72/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
         $(function () {
            setTab(<%=TabIndex %>);
            $('#tabs').tabs({ selected:<%=TabIndex %>,
                select: function (event, ui) {
                    setTab(ui.index);
                }
            });
        });
        function setTab(index) {
            $("#li" + index).addClass("currently");
            $("#li" + index).siblings().removeClass("currently");
        }
        
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="listTable_1">
        <div class="tableTab" id="tabs">
            <div class="place">
                <div class="placeleft">
                    <ul>
                        <li class="currently" id="li0"><a href="#divTrust">委托事项设置</a></li>
                        <li id="li1"><a href="#divTrustList">被委托事项列表</a></li>
                        <li id="li2"><a href="#divTrustTaskList">委托任务列表</a></li>
                    </ul>
                </div>
                <span class="more" style="display: inline-block"><a href="#">更多>></a></span>
            </div>
            <div id="divTrust">
                <table border="0" cellpadding="0" cellspacing="0" class="listTable1">
                    <tr>
                        <td>
                            所属流程
                        </td>
                        <td>
                            开始时间
                        </td>
                        <td>
                        </td>
                        <td>
                            生效时间
                        </td>
                        <td>
                        </td>
                        <td>
                            委托人
                        </td>
                        <td>
                            委托事项状态
                        </td>
                        <td rowspan="2">
                            <asp:Button ID="btnSearch" runat="server" Text="查询" CssClass="btnBg" OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:DropDownList ID="ddlProcessCatalog" runat="server">
                                <asp:ListItem Value="-1">请选择...</asp:ListItem>
                                <asp:ListItem Value="1">内部协办</asp:ListItem>
                                <asp:ListItem Value="2">总公司发文</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <input type="text" name="bussinessID" id="txtBeginTime" class="Wdate inputboder1"
                                onfocus="var endDate=$dp.$('txtBeginTime2');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'txtBeginTime2\')}'})"
                                runat="server" />
                        </td>
                        <td>
                            <input type="text" name="applicantUser" id="txtBeginTime2" class="Wdate inputboder1"
                                runat="server" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtBeginTime\')}'})" />
                        </td>
                        <td>
                            <%--<input type="text" name="taskStartTime" id="taskStartTime" class="inputboder1 inputBg2" runat="server"  />--%><input
                                id="txtEndDate" class="Wdate inputboder1" type="text" onfocus="var endDate=$dp.$('txtEndDate2');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'txtEndDate2\')}'})"
                                runat="server" />-
                            <%--<input type="text" name="taskEndTime" id="taskEndTime" class="inputboder1 inputBg2" runat="server" />--%>
                        </td>
                        <td>
                            <input id="txtEndDate2" class="Wdate inputboder1" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtEndDate\')}'})"
                                runat="server" />
                        </td>
                        <td>
                            <input id="txtUser" class="inputBorder" onfocus="ShowSearchUser(1)" runat="server" />
                            <asp:HiddenField ID="hidUserId" runat="server" />
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlStatus" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="-1">请选择...</asp:ListItem>
                                <asp:ListItem Value="0">待确认</asp:ListItem>
                                <asp:ListItem Value="1">已完成</asp:ListItem>
                                <asp:ListItem Value="2">已取消</asp:ListItem>
                                <asp:ListItem Value="3">已确认生效</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" id="tableList" cellspacing="0" class="listTable3">
                    <tr>
                        <th style="width: 2px">
                            <input name="" type="checkbox" value="" />
                        </th>
                        <th>
                            所属流程
                        </th>
                        <th>
                            开始时间
                        </th>
                        <th>
                            生效时间
                        </th>
                        <th>
                            结束时间
                        </th>
                        <th>
                            受托人
                        </th>
                        <th>
                            委托事项状态
                        </th>
                    </tr>
                    <asp:Repeater ID="rptList" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <input type="checkbox" id="cboList" class="choose" runat="server" />
                                    <asp:HiddenField ID="hidListID" runat="server" Value='<%#Eval("DELEGATION_ID") %>' />
                                </td>
                                <td>
                                    <%#Eval("SUMMARY")==null?"":Eval("SUMMARY").ToString().Substring(0,Eval("SUMMARY").ToString().IndexOf(';')) %>
                                </td>
                                <td>
                                    <%#Eval("START_DATE")%>
                                </td>
                                <td>
                                    <%#Eval("EFFECT_FROM")%>
                                </td>
                                <td>
                                    <%#Eval("END_DATE")%>
                                </td>
                                <td>
                                    <%#Eval("DELEGATOR_USER")%>
                                </td>
                                <td>
                                    <%#GetStatusString(Eval("DELEGATOR_STATUS").ToString())%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td>
                            <input type="button" id="btnAdd" value="新增委托" onclick="ShowAddTrust()" class="btnBg"
                                onclick="return btnAdd_onclick()" />
                            <asp:Button ID="btnReset" runat="server" Text="取消委托" CssClass="btnBg" OnClick="btnReset_Click" />
                        </td>
                        <td colspan="6">
                            <webdiyer:AspNetPager ID="pagination" runat="server" Width="100%" meta:resourcekey="pagination"
                                CssClass="aspNetPager" CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页"
                                PrevPageText="上一页" FirstPageText="首页" LastPageText="末页" OnPageChanging="pagination_PageChanging"
                                PageIndexBoxType="DropDownList" ShowCustomInfoSection="Left" NavigationToolTipTextFormatString='{0}'
                                NumericButtonTextFormatString="{0}">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
            </div>
            <div id="divTrustList">
                <table border="0" cellpadding="0" cellspacing="0" class="listTable1">
                    <tr>
                        <td>
                            所属流程
                        </td>
                        <td>
                            开始时间
                        </td>
                        <td>
                        </td>
                        <td>
                            生效时间
                        </td>
                        <td>
                        </td>
                        <td>
                            委托人
                        </td>
                        <td>
                            委托事项状态
                        </td>
                        <td rowspan="2">
                            <asp:Button ID="btnSelectTrust" runat="server" Text="查询" CssClass="btnBg" OnClick="btnSelectTrust_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:DropDownList ID="dllTrustProcess" runat="server">
                                <asp:ListItem Value="-1">请选择...</asp:ListItem>
                                <asp:ListItem Value="1">内部协办</asp:ListItem>
                                <asp:ListItem Value="2">总公司发文</asp:ListItem>
                            </asp:DropDownList>
                            &nbsp;
                        </td>
                        <td>
                            <input type="text" name="bussinessID" id="txtStartDate" class="Wdate inputboder1"
                                runat="server" onfocus="var endDate=$dp.$('txtStartDate2');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'txtStartDate2\')}'})" />
                        </td>
                        <td>
                            <input type="text" name="applicantUser" id="txtStartDate2" class="Wdate inputboder1"
                                onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\')}'})" runat="server" />
                        </td>
                        <td>
                            <%--<input type="text" name="taskStartTime" id="taskStartTime" class="inputboder1 inputBg2" runat="server"  />--%><input
                                id="txtFromDate" class="Wdate inputboder1" type="text" onfocus="var endDate=$dp.$('txtFromDate2');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'txtFromDate2\')}'})"
                                runat="server" />-
                            <%--<input type="text" name="taskEndTime" id="taskEndTime" class="inputboder1 inputBg2" runat="server" />--%>
                        </td>
                        <td>
                            <input id="txtFromDate2" class="Wdate inputboder1" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtFromDate\')}'})"
                                runat="server" />
                        </td>
                        <td>
                            <input id="txtTrustUser" class="inputBorder" onfocus="ShowSearchUser(2)" runat="server" />
                            <asp:HiddenField runat="server" ID="hidTrustUserId" />
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlTrustStatus" runat="server" CssClass="inputBorder" Height="22px">
                                <asp:ListItem Value="-1">请选择...</asp:ListItem>
                                <asp:ListItem Value="0">待确认</asp:ListItem>
                                <asp:ListItem Value="1">已完成</asp:ListItem>
                                <asp:ListItem Value="2">已取消</asp:ListItem>
                                <asp:ListItem Value="3">已确认生效</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" id="tableTrustList" cellspacing="0" class="listTable3">
                    <tr>
                        <th style="width: 5px">
                            <input name="" type="checkbox" value="" />
                        </th>
                        <th>
                            所属流程
                        </th>
                        <th>
                            开始时间
                        </th>
                        <th>
                            生效时间
                        </th>
                        <th>
                            结束时间
                        </th>
                        <th>
                            受托人
                        </th>
                        <th>
                            委托事项状态
                        </th>
                    </tr>
                    <asp:Repeater ID="rptTrustList" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <input type="checkbox" id="cboTrustList" style='display: <%# Eval("DELEGATOR_STATUS").ToString()=="3"?"none":"" %>'
                                        class="cboChoose" runat="server" />
                                    <asp:HiddenField ID="hidTrustId" runat="server" Value='<%#Eval("DELEGATION_ID") %>' />
                                </td>
                                <td>
                                    <%#Eval("SUMMARY") == null ? "" : Eval("SUMMARY").ToString().Substring(0, Eval("SUMMARY").ToString().IndexOf(';'))%>
                                </td>
                                <td>
                                    <%#Eval("START_DATE")%>
                                </td>
                                <td>
                                    <%#Eval("EFFECT_FROM")%>
                                </td>
                                <td>
                                    <%#Eval("END_DATE")%>
                                </td>
                                <td>
                                    <%#Eval("DELEGATOR_USER")%>
                                </td>
                                <td>
                                    <%#GetStatusString(Eval("DELEGATOR_STATUS").ToString())%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td>
                            <asp:Button ID="btnAffirm" runat="server" Text="确认委托" CssClass="btnBg" OnClick="btnAffirm_Click" />
                            <asp:Button ID="btnRefuse" runat="server" Text="拒绝委托" CssClass="btnBg" OnClick="btnRefuse_Click" />
                        </td>
                        <td colspan="6">
                            <webdiyer:AspNetPager ID="pagination1" runat="server" Width="100%" meta:resourcekey="pagination"
                                CssClass="aspNetPager" CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页"
                                PrevPageText="上一页" FirstPageText="首页" LastPageText="末页" PageIndexBoxType="DropDownList"
                                ShowCustomInfoSection="Left" NavigationToolTipTextFormatString='{0}' NumericButtonTextFormatString="{0}"
                                onpagechanging="pagination1_PageChanging">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
            </div>
            <div id="divTrustTaskList">
                <table border="0" cellpadding="0" cellspacing="0" class="listTable1">
                    <tr>
                        <td>
                            所属流程
                        </td>
                        <td>
                            流程标题
                        </td>
                        <td>
                            业务编号
                        </td>
                        <td>
                            生效时间
                        </td>
                        <td>
                        </td>
                        <td>
                            委托人
                        </td>
                        <td rowspan="2">
                            <asp:Button ID="btnSelectTrustTaskList" runat="server" Text="查询" CssClass="btnBg"
                                OnClick="btnSelectTrustTaskList_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:DropDownList ID="ddlTrustTaskProcess" runat="server">
                                <asp:ListItem Value="-1">请选择...</asp:ListItem>
                                <asp:ListItem Value="1">内部协办</asp:ListItem>
                                <asp:ListItem Value="2">总公司发文</asp:ListItem>
                            </asp:DropDownList>
                            &nbsp;
                        </td>
                        <td>
                            <input type="text" name="bussinessID" id="txtTitle" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <input type="text" name="applicantUser" id="txtNum" class="inputBorder" runat="server" />
                        </td>
                        <td>
                            <%--<input type="text" name="taskStartTime" id="taskStartTime" class="inputboder1 inputBg2" runat="server"  />--%><input
                                id="txtDate" class="Wdate inputboder1" type="text" onfocus="var endDate=$dp.$('txtDate2');WdatePicker({onpicked:function(){},maxDate:'#F{$dp.$D(\'txtDate2\')}'})"
                                runat="server" />-
                            <%--<input type="text" name="taskEndTime" id="taskEndTime" class="inputboder1 inputBg2" runat="server" />--%>
                        </td>
                        <td>
                            <input id="txtDate2" class="Wdate inputboder1" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtDate\')}'})"
                                runat="server" />
                        </td>
                        <td>
                            <input id="txtUserName" class="inputBorder" onfocus="ShowSearchUser(3)" runat="server" />
                            <asp:HiddenField ID="hidTaskUserId" runat="server" />
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" class="listTable3">
                    <tr>
                        <th>
                        </th>
                        <th>
                            <input name="" type="checkbox" value="" />
                        </th>
                        <th>
                            流程标题
                        </th>
                        <th>
                            业务编号
                        </th>
                        <th>
                            所属流程
                        </th>
                        <th>
                            受托人
                        </th>
                        <th>
                            任务名称
                        </th>
                        <th>
                            到达时间
                        </th>
                        <th>
                            截止时间
                        </th>
                        <th>
                            任务状态
                        </th>
                    </tr>
                    <asp:Repeater ID="rptTrustTaskList" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <img src="images/icon3.gif" />
                                </td>
                                <td>
                                    <input name="" type="checkbox" value="" />
                                </td>
                                <td>
                                    <a href="#">
                                        <%#Eval("TASK_TITLE")%></a>
                                </td>
                                <td>
                                    <%#Eval("SUMMARY")==null?"":Eval("SUMMARY").ToString().Substring(0, Eval("SUMMARY").ToString().IndexOf(';'))%>
                                </td>
                                <td>
                                    <%#Eval("SUMMARY") == null ? "" : Eval("SUMMARY").ToString().Substring(Eval("SUMMARY").ToString().IndexOf(';') + 1)%>
                                </td>
                                <td>
                                    <%#Eval("RECIPIENT")%>
                                </td>
                                <td>
                                    <%#Eval("TASK_NAME")%>
                                </td>
                                <td>
                                    <%#Eval("START_TIME")%>
                                </td>
                                <td>
                                    <%#Eval("END_TIME")%>
                                </td>
                                <td>
                                    <%#Eval("STATUS")%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td colspan="10">
                            <webdiyer:AspNetPager ID="pagination2" runat="server" Width="100%" meta:resourcekey="pagination"
                                CssClass="aspNetPager" CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页"
                                PrevPageText="上一页" FirstPageText="首页" LastPageText="末页" PageIndexBoxType="DropDownList"
                                ShowCustomInfoSection="Left" NavigationToolTipTextFormatString='{0}' NumericButtonTextFormatString="{0}"
                                onpagechanging="pagination2_PageChanging">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
    function CallBack(userId, userName, type) {
        if (type == 1) {
            $("#txtUser").val(userName);
            $("#hidUserId").val(userId);
            $("#btnSearch").focus();
        } else if (type == 2) {
            $("#txtTrustUser").val(userName);
            $("#hidTrustUserId").val(userId);
            $("#btnSelectTrust").focus();
        } else if (type == 3) {
            $("#txtUserName").val(userName);
            $("#hidTaskUserId").val(userId);
            $("#btnSelectTrustTaskList").focus();
        }
        
    }
    
    function ShowSearchUser(type) {
        var str = window.showModalDialog("SearchUser.aspx?type=" + type, "", "dialogWidth=700px;dialogHeight=450px;dialogLeft=0px;dialogTop=0px;location=no;");
        if (str != null) {
            var strSplit = str.split(',');
            CallBack(strSplit[0], strSplit[1], strSplit[2])
        }
    }
    function ShowAddTrust() {
        window.showModalDialog("AddTrust.aspx", "", "dialogWidth=800px;dialogHeight=600px;dialogLeft=0px;dialogTop=0px;location=no;");

    }

</script>
